#include "manualpage.h"
#include "ui_manualpage.h"
#include "mainWidget.h"

ManualPage::ManualPage(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ManualPage)
{
    ui->setupUi(this);

    pWidget = static_cast<Widget*>(parent);

    this->init();

    connect(ui->Btn_stackding, &QPushButton::clicked, this, [=](){
        pWidget->stackingPage();
    });
    connect(ui->Btn_memoryPoint, &QPushButton::clicked, this, [=](){
        pWidget->memoryPointPage();
    });

    connect(ui->Btn_speedAdd5, &QPushButton::clicked, this, [=](){
        ui->label_speed->setText(QString::number(ui->label_speed->text().toInt()+5));
    });
    connect(ui->Btn_speedAdd10, &QPushButton::clicked, this, [=](){
        ui->label_speed->setText(QString::number(ui->label_speed->text().toInt()+10));
    });
    connect(ui->Btn_speedMinus5, &QPushButton::clicked, this, [=](){
        ui->label_speed->setText(QString::number(ui->label_speed->text().toInt()-5));
    });
    connect(ui->Btn_speedMinus10, &QPushButton::clicked, this, [=](){
        ui->label_speed->setText(QString::number(ui->label_speed->text().toInt()-10));
    });
    connect(ui->Btn_mulAdd1, &QPushButton::clicked, this, [=](){
        ui->label_mul->setText(QString::number(ui->label_mul->text().toDouble()+0.1, 'f', 1));
    });
    connect(ui->Btn_mulAdd10, &QPushButton::clicked, this, [=](){
        ui->label_mul->setText(QString::number(ui->label_mul->text().toDouble()+1, 'f', 1));
    });
    connect(ui->Btn_mulMinus1, &QPushButton::clicked, this, [=](){
        ui->label_mul->setText(QString::number(ui->label_mul->text().toDouble()-0.1, 'f', 1));
    });
    connect(ui->Btn_mulMinus10, &QPushButton::clicked, this, [=](){
        ui->label_mul->setText(QString::number(ui->label_mul->text().toDouble()-1, 'f', 1));
    });
}

ManualPage::~ManualPage()
{
    delete ui;
}

void ManualPage::init()
{
    ui->label_speed->setText("0");
    ui->label_mul->setText("0");
    ui->stackedWidget_dialog->hide();
}
